//
//  XCInterestContentView.m
//  XCNewsApp
//
//  Created by FAITH on 16/12/9.
//  Copyright © 2016年 XC. All rights reserved.
//

#import "XCInterestContentView.h"
#import "XCInterestContentButton.h"



@implementation XCInterestContentView


+(XCInterestContentView *)menuViewWithArray:(NSArray *)menuArray viewHeight:(CGFloat)viewHeight
{
    XCInterestContentView *menuView=[[XCInterestContentView alloc] initWithFrame:CGRectMake(0, 100, kScreenW-150, viewHeight+30)];
    
    UILabel *titleLabel=[[UILabel alloc] initWithFrame:CGRectMake(0, 0, menuView.width, 25)];
    
    titleLabel.font=[UIFont systemFontOfSize:20];
    
    titleLabel.textColor=[UIColor grayColor];
    
    titleLabel.textAlignment=NSTextAlignmentCenter;
    
    titleLabel.text=@"搜索感兴趣的内容";
    
    [menuView addSubview:titleLabel];
    
    UIView *lineView=[[UIView alloc] initWithFrame:CGRectMake(0, 27, menuView.width, 1)];
    
    lineView.backgroundColor=RGBColorAlpha(0, 0, 0, 0.4);
    
    [menuView addSubview:lineView];
    
    CGFloat W=(kScreenW-150)/menuArray.count;
    
    for (int i=0; i<menuArray.count; i++) {
        NSDictionary *menu=menuArray[i];
        
        XCInterestContentButton *btn=[[XCInterestContentButton alloc] init];
        
        [btn setImage:[UIImage imageNamed:menu[@"image"]] forState:UIControlStateNormal];
        
        [btn setTitle:menu[@"name"] forState:UIControlStateNormal];
        
        btn.frame=CGRectMake(i*W, 50, W, viewHeight);
        
        [menuView addSubview:btn];
    }
    
    
    return menuView;
}


@end
